package com.xtpt.disaster.common.SQLServer;

import com.xtpt.disaster.common.AgentInfo;
import com.xtpt.disaster.common.PropertyConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author jack_xin
 * @ClassName CallbackUrlGenerator
 * @Desc SQLServer生成备份恢复结果回调地址
 * @date 2021年12月07日 11:03
 * @Version TODO
 */
@Component
public class CallbackUrlGenerator {
    @Autowired
    AgentInfo chaoClientInfo;

    @Autowired
    PropertyConfig config;

    public String urlGenerator (String requestPath){
        String callbackUrl = "http://" + config.getServerIp() + ":"+ config.getServerPort();
        if(requestPath.startsWith("/"))
        {
            return callbackUrl+requestPath;
        }
        else
        {
            return callbackUrl+"/"+requestPath;
        }
    }

}
